﻿package ascript.components.general
{
	//#########################
	// Header Includes
	//#########################
	import ascript.Game;
	import ascript.GameComponent;
	import ascript.GameLevel;
	import ascript.GameObject;
	
	//#########################
	// GeneralSpin Class
	//#########################
	public class GeneralSpin extends GameComponent
	{
		//=========================
		// Constructors
		//=========================	
		public function GeneralSpin()
		{
		}
		
		//=========================
		// Members
		//=========================	
		override public function initComponent( tGame:Game, tObject:GameObject ):void
		{
			// Set Default Attributes
			defaultAttribute( tObject, "Rotation", tObject.rotation );
			defaultAttribute( tObject, "Spin", 0 );
		}
		
		override public function updateComponent( tGame:Game, tObject:GameObject, tLevel:GameLevel ):void
		{
			// Apply Spin
			if ( tObject.getAttribute( "Spin" ) != 0 )
			{
				tObject.setAttribute( "Rotatation", ( tObject.getAttribute( "Rotation" ) + tObject.getAttribute( "Spin" ) ) );
			}
		}
	}
}